import { getInitialFieldsValue } from '@/pages/supplier/utils'
import { priceSupervisionForm } from '@/pages/supplier/constants'
const {
  QUESTION_REASON_MAP_OBJECT,
  QUESTION_LEVEL_MAP_OBJECT,
} = priceSupervisionForm

// 核查管理 - 正常价格核查
const FORM_ITEM_LIST = [
  { prop: 'supplierCode', label: '供应商代码', type: 'input', },
  { prop: 'supplierName', label: '供应商名称', type: 'input', },
  { prop: 'productCode', label: '商品代码', type: 'input', },
  { prop: 'productName', label: '商品名称', type: 'input', },
  { prop: 'unit', label: '计量单位', type: 'input', },
  { prop: 'specification', label: '规格型号', type: 'input', },
  { prop: 'priceRatio', label: '价格比例', type: 'input', },
  { prop: 'balance', label: '差额', type: 'input', },
  // { prop: 'isMetal', label: '是否钢材', type: 'select', options: METAL_SELECT_LIST },
  { prop: 'specificCauses', label: '具体原因', type: 'input', },
  { prop: 'questionLevel', label: '问题等级', type: 'input', },
  { prop: 'createUserId', label: '核查人', type: 'userSelect', },
  { prop: 'time', label: '核查时间', type: 'datePicker', },
  { prop: 'managementAreaId', label: '管理区域', type: 'managementArea' },
]
const INITIAL_FIELDS_VALUE = getInitialFieldsValue(FORM_ITEM_LIST)
const TABLE_COLUMNS = [
  { title: '序号', key: 'index', width: 50 },
  { key: 'supplierCode', title: '供应商代码' },
  { key: 'supplierName', title: '供应商名称' },
  { key: 'productCode', title: '商品代码' },
  { key: 'productName', title: '商品名称' },
  { key: 'specification', title: '规格型号' },
  { key: 'unit', title: '计量单位' },
  { key: 'manageAreaName', title: '管理区域' },
  { key: 'belongDepartmentName', title: '归属中心' },
  { key: 'checkAreaName', title: '核查区域' },
  { key: 'lastYearPurchaseCount', title: '上年度进货数量' },
  { key: 'lastYearPurchaseAmount', title: '上年度进货金额' },
  { key: 'price', title: '进价' },
  { key: 'thisYearPurchaseCount', title: '本年度进货数量' },
  { key: 'thisYearPurchaseAmount', title: '本年度进货金额' },
  { key: 'checkPrice', title: '核查价格' },
  { key: 'priceRatio', title: '价格比例' },
  { key: 'balance', title: '差额' },
  { key: 'questionLevel',
    title: '问题等级',
    formatter: (row, column, cellValue) => {
      return QUESTION_LEVEL_MAP_OBJECT[cellValue] || '-'
    }
  },
  { key: 'specificCauses',
    title: '具体原因',
    formatter: (row, column, cellValue) => {
      return QUESTION_REASON_MAP_OBJECT[cellValue] || '-'
    }
  },
  { key: 'createUser', title: '核查人' },
  { key: 'createTime', title: '核查时间' },
]
export {
  INITIAL_FIELDS_VALUE,
  FORM_ITEM_LIST,
  TABLE_COLUMNS
}
